package com.cswnode.demo.entity;

/**
 * @author csw
 * @create 2021/1/26 11:23
 */

public class CodeMsg {
    public static CodeMsg OK = new CodeMsg(200, "success");
    public static CodeMsg Created = new CodeMsg(201, "请求成功，新的资源已创建");
    public static CodeMsg Accepted = new CodeMsg(202, "请求成功，后续进行异步处理");
    public static CodeMsg No_Content = new CodeMsg(204, "内容不存在");
    public static CodeMsg Multiple_Choices = new CodeMsg(300, "存在多个资源");
    public static CodeMsg Moved_Permanently = new CodeMsg(301, "资源被永久转移");
    public static CodeMsg Not_Modified = new CodeMsg(304, "自上一次访问后没有发生更新");
    public static CodeMsg Temporary_Redirect = new CodeMsg(307, "请求的资源被暂时转移");
    public static CodeMsg Bad_Request = new CodeMsg(400, "请求不正确");
    public static CodeMsg Unauthorized = new CodeMsg(401, "认证失效");
    public static CodeMsg Forbidden = new CodeMsg(403, "禁止访问");
    public static CodeMsg Not_Found = new CodeMsg(404, "没有找到指定资源");
    public static CodeMsg Method_Not_Allowed = new CodeMsg(405, "无法使用指定的方法");
    public static CodeMsg Not_Acceptable = new CodeMsg(406, "同Accept相关联的首部里含有无法处理的内容");
    public static CodeMsg Request_Timeout = new CodeMsg(408, "请求在规定时间内没有处理结束");
    public static CodeMsg Conflict = new CodeMsg(409, "资源存在冲突");
    public static CodeMsg Gone = new CodeMsg(410, "指定的资源已不存在");
    public static CodeMsg Request_Entity_Too_Large = new CodeMsg(413, "请求消息体太大");
    public static CodeMsg Request_Uri_Too_Long = new CodeMsg(414, "请求的URI太长");
    public static CodeMsg Unsupported_Media_Type = new CodeMsg(415, "不支持所指定的媒体类型");
    public static CodeMsg Too_Many_Request = new CodeMsg(429, "请求次数过多");
    public static CodeMsg Internal_Server_Error = new CodeMsg(500, "服务端发生错误");
    public static CodeMsg Service_Unavailable = new CodeMsg(503, "服务器暂时停止运行");
    public static CodeMsg Search_Fail = new CodeMsg(10000, "数据查询失败");
    public static CodeMsg Add_Fail = new CodeMsg(20000, "数据添加失败");
    public static CodeMsg Save_Fail = new CodeMsg(30000, "数据保存失败");
    public static CodeMsg Update_Fail = new CodeMsg(40000, "数据更新失败");
    public static CodeMsg Delete_Fail = new CodeMsg(50000, "数据删除失败");
    private int code;
    private String msg;

    public CodeMsg() {
    }

    public CodeMsg(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public int getCode() {
        return this.code;
    }

    public String getMsg() {
        return this.msg;
    }
    @Override
    public String toString() {
        return "CodeMsg{code=" + this.code + ", msg='" + this.msg + '\'' + '}';
    }
}
